<template>
	<view class="app-container question-detail">
		<u-form :model="form">
			<u-form-item  label-width="140" label="提问人:">
				{{form.nickname}}
			</u-form-item>
			<u-form-item  label-width="160" label="问题标题:">
				<text>{{form.title}}</text>
			</u-form-item>
			<u-form-item  label-width="160" label="问题内容:" label-position="top">
				<text>{{form.description}}</text>
			</u-form-item>
			<u-form-item label-width="180"  label-position="top" label="附加图片:">
				<view class="" v-for=" item in form.images">
					<u-image width="300rpx" height="300rpx" :src="item"></u-image>
				</view>
			</u-form-item>
		</u-form>
		<view class="question-detail-answer">
			<view class="answer-title">
				问题回复：
			</view>
			<view class="question-item" v-for="item in form.answers">
				<view class="question-item-top">
					<u-avatar style="height: 60rpx;" :size="60" :src="qitem.avatar"></u-avatar>
					<view class="question-item-top-right">
						<view class="top-right-name">
							{{item.nickname}} {{item.objectName}}
						</view>
						<view class="top-right-name-time">
							{{item.createdOn}}
						</view>
					</view>
				</view>
				<view class="question-item-bottom">
					{{item.content}}
				</view>
			</view>
		</view>
		<!-- <view class="bottom-btn">
			<u-input type="primay" placeholder="请输入回复"></u-input>
			<u-button type="primary">回复</u-button>
		</view> -->
	</view>
</template>

<script>
	import * as that from '@/API/index.js'
	export default {
		data() {
			return {
				id:'',
				questionMsg:'',
				form:''
			};
		},
		onLoad({id}) {
			this.id = id
			this.getQuestionDetail()
		},
		methods:{
			// 获取问题详情
			getQuestionDetail(){
				that.questionDetail(this.id).then(res =>{
					console.log(res)
					this.form = res.data
					this.form.images = res.data.images.split(',')
				})
			}
		}
	}
</script>

<style lang="scss">
.question-detail{
	padding-bottom: 40rpx;
	.answer-title{
		margin: $uni-spacing-20 0;
		font-size: $uni-font-size-20;
		color: #000000;
	}
	.question-item{
		background-color: $uni-bg-color;
		margin-bottom: $uni-spacing-20;
		background: #f5f5f5;
		padding: 20rpx;
		border-radius: 10rpx;
		.question-item-top{
			display: flex;
			align-items: center;
			// border-bottom: 1px solid #ebebeb;
			.question-item-top-right{
				margin-left: 10rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				padding: 10rpx 0;
			}
			.top-right-name-time{
				font-size: 12px;
			}
		}
		.question-item-bottom{
			color: #000000;
			font-size: $uni-font-size-16;
			margin-top: $uni-spacing-10;
		}
	}
}
</style>
